package com.xinchao.job.task;

import com.xinchao.job.service.advertise.AdvertiseService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.util.StopWatch;

/**
 * @ClassName AdvertiseJob
 * @Description 处理播控助手数据：路线表、上刊表、路单表
 * @Author HanQinrui
 * @Date 2018/9/28 14:21
 * @Version 1.0
 **/
@DisallowConcurrentExecution
public class AdvertiseJob extends QuartzJobBean {
    private static Logger logger = LoggerFactory.getLogger(AdvertiseJob.class);
    @Autowired
    private AdvertiseService advertiseService;
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        logger.info("执行处理播控助手后台数据：路线表、上刊表、路单表【AdvertiseJob】" );
        try {
            advertiseService.handleAdvertiseInfo();
        } catch (Exception e) {
            e.printStackTrace();
        }
        stopWatch.stop();
        logger.info("【AdvertiseJob】执行完毕，执行时间："+stopWatch.getTotalTimeSeconds());
    }
}
